<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="ThemeBucket">
  <link rel="shortcut icon" href="#" type="image/png">

  <title>Editable Table</title>

  <!--data table-->
  <link rel="stylesheet" href="js/data-tables/DT_bootstrap.css" />


    <!--公共css-->
    <link th:include="common::commonheader">
</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <div th:replace="common::leftmenu"></div>
    <!-- left side end-->

    <!-- main content start-->
    <div class="main-content" >

        <!-- 头部分开始-->
        <div th:replace="common::headermenu"></div>
        <!-- header section end-->


        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                可编辑课程页面
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Dashboard</a>
                </li>
                <li>
                    <a href="#">Data Table</a>
                </li>
                <li class="active"> 可编辑课程页面 </li>
            </ul>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <div class="wrapper">
             <div class="row">
                <div class="col-sm-12">
                <section class="panel">
                <header class="panel-heading">
                    Editable Table
                    <span class="tools pull-right">
                        <a href="javascript:;" class="fa fa-chevron-down"></a>
                        <a href="javascript:;" class="fa fa-times"></a>
                     </span>
                </header>
                <div class="panel-body">
                <div class="adv-table editable-table ">
                <div class="clearfix">
                    <div class="btn-group">
                        <a th:href="@{/adminRole/toUodateCourse}" class="btn btn-primary">
                            Add New <i class="fa fa-plus"></i>
                        </a>
                    </div>
                    <div class="btn-group pull-right">
                        <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">Tools <i class="fa fa-angle-down"></i>
                        </button>
                        <ul class="dropdown-menu pull-right">
                            <li><a href="#">Print</a></li>
                            <li><a href="#">Save as PDF</a></li>
                            <li><a href="#">Export to Excel</a></li>
                        </ul>
                    </div>
                </div>
                <div class="space15"></div>
                <table class="table table-striped table-hover table-bordered" id="editable-sample">
                <thead>
                <tr>
                    <th>课程名</th>
                    <th>学分</th>
                    <th>开设时期</th>
                    <th>可选人数</th>
                    <th>可选年级</th>
                    <th>编辑</th>
                    <th>删除</th>
                </tr>
                </thead>
                <tbody>
                <tr class=""  th:each="courseEdit:${courseEdits}">
                    <td th:text="${courseEdit.getName()}"></td>
                    <td th:text="${courseEdit.getCredit()}"></td>
                    <td th:text="第+${courseEdit.getTimeStart()}+到+${courseEdit.getTimeEnd()}+周+${courseEdit.getTerm()}+季学期"></td>
                    <td th:text="${courseEdit.getPlaces()}"></td>
                    <td th:text="大+${courseEdit.getAvailableGrade()}"></td>
                    <td><a th:href="@{/adminRole/toeditCourse/{id}(id=${courseEdit.getId()})}"  class="btn btn-success" type="button">编辑</a></td>
                    <td><a th:href="@{/adminRole/deleteCourse/{id}(id=${courseEdit.getId()})}" class="btn btn-danger" type="button">删除</a></td>
                </tr>

                </tbody>
                </table>
                </div>
                </div>
                </section>
                </div>
                </div>
        </div>
        <!--body wrapper end-->
        <div class="alert alert-success alert-block fade in" th:unless="${#strings.isEmpty(message)}">
            <button type="button" class="close close-sm" data-dismiss="alert">
                <i class="fa fa-times"></i>
            </button>
            <h4>
                <i class="icon-ok-sign"></i>
                Success!
            </h4>
            <p th:text="${message}"></p>
        </div>

        <!--footer section start-->
        <footer>
            @Admin & editCourseInfo
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<div th:replace="common::commonscript"/>
<!--data table-->
<script type="text/javascript" th:src="@{/js/data-tables/jquery.dataTables.js}"></script>
<script type="text/javascript" th:src="@{/js/data-tables/DT_bootstrap.js}"></script>


<!--script for editable table-->
<script th:src="@{/js/editable-table.js}"></script>

<!-- END JAVASCRIPTS -->
<script>
    jQuery(document).ready(function() {
        EditableTable.init();
    });
    $(".message .close").on('click',function () {
        $(this).closest(".message")
            .transition("fade");
    })
</script>

</body>
</html>
